package com.stan.core.mapper;

import com.stan.core.vo.AdRealTimeCount;
import org.apache.ibatis.annotations.*;
import scala.collection.immutable.List;

/**
 * 实时点击量 Mapper
 */
@Mapper
public interface AdRealTimeCountMapper {
    @Select("select date,province,city,aid,click_count as clickCount from t_ad_province_count where date=#{date} " +
            "and province = #{province} and city = #{city} and aid = #{aid} limit 1")
    AdRealTimeCount getAdRealTimeCount(AdRealTimeCount adRealTimeCount);

    @Select("select date,province,city,aid,click_count as clickCount from t_ad_province_count")
    List<AdRealTimeCount> getAllAdRealTimeCount();

    @Update("update t_ad_province_count set date = #{date}," +
            "province = #{province},city=#{city},aid=#{aid},click_count=#{clickCount} " +
            "where date = #{date} and province = #{province} and city=#{city} and" +
            " aid=#{aid}")
    void updateAdRealTimeCount(AdRealTimeCount adRealTimeCount);

    @Insert("insert into t_ad_province_count (date,province,city,aid,click_count) values " +
            "(#{date},#{province},#{city},#{aid},#{clickCount})")
    void addAdRealTimeCount(AdRealTimeCount adRealTimeCount);

}
